﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="empresa.aspx.cs" Inherits="area_admin_equipamentos"  EnableEventValidation="false"%>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Panel ID="Panel1" runat="server">
        <table style="width: 100%">
            <tr>
                <td>
                    <br />
                    &nbsp;Nome Fantasia:</td>
                <td>
                    <asp:TextBox ID="txtDescricao" runat="server" ValidationGroup="busca"></asp:TextBox>
                </td>
                <td width="100%">
                    <asp:Button ID="btnPesquisar" runat="server" onclick="btnPesquisar_Click" 
                        Text="Buscar" Width="70px" CausesValidation="False" />
                    <asp:Button ID="btnNovo" runat="server" CausesValidation="False" 
                        onclick="btnNovo_Click" Text="Nova Empresa" Width="120px" />
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="3">
                    <asp:Panel ID="pnlInserir" runat="server" SkinID="Insercao" Visible="False" 
                        Width="100%">
                        <table style="padding: 3px; width: 100%">
                            <tr>
                                <td class="titulo3" colspan="2">
                                    Informações da Empresa</td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                        ControlToValidate="txtRazaoSocial" ErrorMessage="*" Font-Names="Vrinda" 
                                        Font-Size="16pt" ForeColor="#FF6699" SetFocusOnError="True" 
                                        ValidationGroup="insercao">*</asp:RequiredFieldValidator>
                                    &nbsp;Razão Social:</td>
                                <td>
                                    <asp:TextBox ID="txtRazaoSocial" runat="server" Width="300px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    Nome Fantasia:</td>
                                <td>
                                    <asp:TextBox ID="txtNomeFantasia" runat="server" Width="300px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    * CNPJ:</td>
                                <td>
                                    <asp:TextBox ID="txtCNPJ" runat="server" Width="100px"></asp:TextBox>
                                    <cc1:MaskedEditExtender ID="txtCNPJ_MaskedEditExtender" runat="server" 
                                        CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                        CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                        CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                        Mask="999\.999\.999\-99" MaskType="Number" TargetControlID="txtCNPJ">
                                    </cc1:MaskedEditExtender>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    Funcionário Responsável:</td>
                                <td>
                                    <asp:DropDownList ID="droplistFuncionarios" runat="server" 
                                        DataSourceID="linddsFuncionarios" DataTextField="Nome" 
                                        DataValueField="idFuncionario" Width="300px" AppendDataBoundItems="True">
                                        <asp:ListItem Selected="True">&gt;&gt; Selecione ... &lt;&lt;</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:LinqDataSource ID="linddsFuncionarios" runat="server" 
                                        ContextTypeName="dbSisInfoDataContext" TableName="FUNCIONARIOs">
                                    </asp:LinqDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 193px; text-align: right;">
                                    &nbsp;</td>
                                <td>
                                    <asp:Button ID="btnIncluir" runat="server" onclick="btnIncluir_Click" 
                                        Text="Incluir" ValidationGroup="insercao" Width="70px" />
                                    <cc1:ModalPopupExtender ID="btnIncluir_ModalPopupExtender" runat="server" 
                                        BackgroundCssClass="modalBackground" CancelControlID="btnNao" 
                                        DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirm" 
                                        TargetControlID="btnIncluir">
                                    </cc1:ModalPopupExtender>
                                    <asp:Button ID="btnCancela" runat="server" onclick="btnCancela_Click" 
                                        Text="Cancelar" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
        </table>
        <asp:GridView ID="grdEmpresas" runat="server" AutoGenerateColumns="False" 
            DataSourceID="linqEmpresas" DataKeyNames="idEmpresa" 
            onselectedindexchanged="grdSituacoes_SelectedIndexChanged" 
            EnableTheming="True" Width="380px" EmptyDataText="Nenhum equipamento encontrado." 
            onrowdeleting="grdEquipamentos_RowDeleting" 
            ondatabound="grdEquipamentos_DataBound" 
            onrowediting="grdEquipamentos_RowEditing" AllowPaging="True" SkinID="q">
            <Columns>
                <asp:TemplateField HeaderText="Lista de Empresas" InsertVisible="False" 
                    SortExpression="idSituacao">
                    <EditItemTemplate>
                        <table style="width: 100%">
                            <tr>
                                <td ID="20">
                                    <asp:Panel ID="pnlEdit" runat="server" SkinID="Insercao" Width="100%">
                                        <table style="padding: 3px; width: 100%">
                                            <tr>
                                                <td class="titulo3" colspan="2">
                                                    Informações da Empresa</td>
                                            </tr>
                                            <tr>
                                                <td style="width: 193px; text-align: right;">
                                                    * Razão Social:</td>
                                                <td>
                                                    <asp:TextBox ID="txtRazaoSocial" runat="server" 
                                                        Text='<%# Eval("RazaoSocial") %>' Width="300px"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 193px; text-align: right;">
                                                    Nome Fantasia:</td>
                                                <td>
                                                    <asp:TextBox ID="txtNomeFantasia" runat="server" Text='<%# Eval("Fantasia") %>' 
                                                        Width="300px"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 193px; text-align: right;">
                                                    * CNPJ:</td>
                                                <td>
                                                    <asp:TextBox ID="txtCNPJ" runat="server" Text='<%# Eval("CNPJ") %>' 
                                                        Width="100px"></asp:TextBox>
                                                    <cc1:MaskedEditExtender ID="txtCNPJ_MaskedEditExtender" runat="server" 
                                                        CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                                        CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                        CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                                                        Mask="999\.999\.999\-99" MaskType="Number" TargetControlID="txtCNPJ">
                                                    </cc1:MaskedEditExtender>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 193px; text-align: right;">
                                                    Funcionário Responsável:</td>
                                                <td>
                                                    <asp:DropDownList ID="droplistFuncionarios" runat="server" 
                                                        DataSourceID="linqFuncionarios" DataTextField="Nome" 
                                                        DataValueField="idFuncionario" SelectedValue='<%# Eval("Responsavel") %>' 
                                                        Width="300px">
                                                    </asp:DropDownList>
                                                    <asp:LinqDataSource ID="linqFuncionarios" runat="server" 
                                                        ContextTypeName="dbSisInfoDataContext" TableName="FUNCIONARIOs">
                                                    </asp:LinqDataSource>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 193px; text-align: right;">
                                                    &nbsp;</td>
                                                <td>
                                                    <asp:Button ID="btnSalvar" runat="server" CommandName="Update" TabIndex="1" 
                                                        Text="Salvar" Width="100px" />
                                                    <asp:Button ID="btnSalvar0" runat="server" CommandName="Cancel" TabIndex="2" 
                                                        Text="Cancelar" Width="100px" />
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <table style="width: 100%">
                            <tr>
                                <td ID="2">
                                    <asp:Label ID="Label1" runat="server" Font-Bold="True" 
                                        Text='<%# Eval("Fantasia") %>' CssClass="titulo3"></asp:Label>
                                    <br />
                                    Razao Social:<asp:Label ID="Label3" runat="server" Font-Bold="True" 
                                        Text='<%# Eval("RazaoSocial") %>'></asp:Label>
                                    <br />
                                    CNPJ:<asp:Label ID="Label2" runat="server" Font-Bold="True" 
                                        Text='<%# Eval("CNPJ") %>'></asp:Label>
                                    <br />
                                    Responsável:<asp:Label ID="Label4" runat="server" Font-Bold="True" 
                                        Text='<%# Eval("Responsavel") %>'></asp:Label>
                                    <br />
                                </td>
                                <td valign="top" width="80px">
                                    <asp:Button ID="Button2" runat="server" CommandName="Edit" 
                                        SkinID="EditarOnTop" ValidationGroup="edicao" />
                                    <asp:Button ID="Button1" runat="server" CommandName="Select" 
                                        SkinID="ExcluirOnTop" />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:LinqDataSource ID="linqEmpresas" runat="server" 
            ContextTypeName="dbSisInfoDataContext" EnableDelete="True" EnableUpdate="True" 
            OrderBy="Fantasia" TableName="EMPRESAs">
        </asp:LinqDataSource>
        <asp:Panel ID="pnlConfirm" runat="server" Height="100px" 
            HorizontalAlign="Center" SkinID="Confirmacao" Width="300px">
            <br />
            <asp:Label ID="Label2" runat="server" Text="Deseja confirmar?"></asp:Label>
            <br />
            <br />
            <asp:Button ID="btnSim" runat="server" onclick="btnIncluir_Click" Text="Sim" 
                ValidationGroup="insercao" />
            <asp:Button ID="btnNao" runat="server" Text="Nao" />
            <br />
            <asp:UpdateProgress ID="UpdateProgress2" runat="server">
                <ProgressTemplate>
                    CARREGANDO...
                </ProgressTemplate>
            </asp:UpdateProgress>
        </asp:Panel>
        <asp:Panel ID="pnlConfirmDelete" runat="server" Height="100px" 
            HorizontalAlign="Center" SkinID="Confirmacao" Width="300px">
            <br />
            <asp:Label ID="Label3" runat="server" Text="Deseja confirmar?"></asp:Label>
            <br />
            <br />
            <asp:Button ID="btnSim0" runat="server" CausesValidation="False" Text="Sim" 
                onclick="btnSim0_Click" />
            <asp:Button ID="btnNao0" runat="server" CausesValidation="False" Text="Nao" />
            <br />
            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    CARREGANDO...
                </ProgressTemplate>
            </asp:UpdateProgress>
        </asp:Panel>
        <asp:Label ID="lbDelete" runat="server" Text="."></asp:Label>
        <br />
        <cc1:ModalPopupExtender ID="Button1_ModalPopupExtender" runat="server" 
            BackgroundCssClass="modalBackground" CancelControlID="btnNao0" 
            DynamicServicePath="" Enabled="True" PopupControlID="pnlConfirmDelete" 
            TargetControlID="lbDelete">
        </cc1:ModalPopupExtender>
    </asp:Panel>
</asp:Content>

